<?php
$xtpl = new XTemplate("modules/home/testimonials.htm");
$page = $_GET['page'];
//--
//--
$waypathlink = ':&nbsp;&raquo;&nbsp;Testimonials&nbsp;Management</a>';
$xtpl_main->assign("waypathlink",$waypathlink);
//--
//--
//--
$add_button = $GUI->button_ren("New","javascript: add('?mod=home&act=testimonials_task&cid=".$cid."');");
$xtpl->assign("add_button",$add_button);
//--
$delete_button = $GUI->button_ren("Delete","javascript: del('DELETE', document.frmAddtestimonials);");
$xtpl->assign("delete_button",$delete_button);
//--
//--
//--
$limit = 20;
$pagegroup_size = 10;
if (!$page||$page==0){
	$page=1;
}
$offset = ($page-1)*$limit;
//////
/////////////////////////
$sql_c = "SELECT COUNT(*) AS total_msg FROM {$DP}testimonial WHERE id_lang='".$_SESSION['ID_LANG_ADM']."'"; 
$rs_c = mysql_query($sql_c);
list($numrec)=mysql_fetch_row($rs_c);
//////////////////////////
$rs = $DB->ZenDataList('testimonial','',"id_lang='".$_SESSION['ID_LANG_ADM']."'  ",'id DESC',$offset.','.$limit);
$no=1;
while($row = mysql_fetch_array($rs)){
	$row[no]=$no++;	
	if($no%2!=0)
		$row['class'] = "row1";
	else 
		$row['class'] = "row2";
	//--
	$row[edit_link] = '?mod=home&act=testimonials_task&id='.$row['id'].'';
	//--
	$row[headline]=stripslashes($row[headline]);
	$xtpl->assign("list",$row);
	$xtpl->parse("center.list");
}
//--
$pages = pagenavigator($page,$numrec,$limit,$pagegroup_size,"row0","?mod=home&act=testimonials&cid=".$cid."");
$row[headline]=stripslashes($row[headline]);
$xtpl->assign("page",$page);
$xtpl->assign("pages",$pages);
$xtpl->assign("numrec",$numrec);
//--
//--
//--
if($_POST['type'] == "DELETE"){
	$checked_delete = $_POST[checked_delete];
	for ($i=0;$i<count($checked_delete);$i++) {
		$delete_list.= $checked_delete[$i].",";
	}
	if($delete_list){
		$delete_list = substr($delete_list,0,strlen($delete_list)-1);
		$delete_split=split(",",$delete_list);
		for($i=0;$i<count($delete_split);$i++){	
			$sql = "DELETE FROM testimonials WHERE id='".$delete_split[$i]."'";
			mysql_query($sql);
		}
	}
	$GUI->redir('?mod=home&act=testimonials&cid='.$cid.'');
}
//--

?>